#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>

bool LeapYear(int year)
{
    if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)
    {
        return true;
    }
    else
    {
        return false;
    }
}

bool DateLawful(int year, int month, int day)
{
    int arr[] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
    if (LeapYear(year))
    {
        arr[2]++;
    }
    if (month == 0 || month > 12)
    {
        return false;
    }
    if (day == 0 || day > arr[month])
    {
        return false;
    }
    return true;
}

int main(int argc, char* argv[])
{
    int year = 0, month = 0, day = 0;
    scanf("%d/%d/%d", &year, &month, &day);
    int i = 0;
    for (i = 19600101; i <= 20591231; i++)
    {
        int y = i / 10000, m = i / 100 % 100, d = i % 100;
        if (DateLawful(y, m, d))
        {
            if ((y % 100 == year && m == month && d == day) || (m == year && d == month && y % 100 == day) || (d == year && m == month && y % 100 == day))
            {
                printf("%d-%02d-%02d\n", y, m, d);
            }
        }
    }
    return 0;
}